package com.chang.controller;

import com.chang.bean.Det;
import com.chang.common.bean.ResultBean;
import com.chang.common.controller.BaseController;
import com.chang.common.group.ISave;
import com.chang.common.group.V;
import com.chang.service.DetService;
import com.chang.service.impl.DetServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @program: erp-api
 * @description: 产品控制类
 * @author: chang
 * @create: 2025-02-21 15h
 **/
@RestController
@RequestMapping("/api")
@Api(tags = "产品管理")
public class DetController extends BaseController {

    @Autowired
    DetServiceImpl detService;

    @ApiOperation("保存产品")
    @PostMapping("/det")
    public ResultBean save(@Validated(ISave.class) @RequestBody Det det, BindingResult result){
        V.validate(result);
        int rs = detService.save(det);
        return saveResult(rs);
    }


}
